package cn.wolfcode.p2p.business.controller;

import cn.wolfcode.p2p.base.query.QueryObject;
import cn.wolfcode.p2p.business.domain.PlatformBankInfo;
import cn.wolfcode.p2p.business.service.IPlatformBankInfoService;
import cn.wolfcode.p2p.util.JSONResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 银行账户管理
 */
@Controller
public class PlatformBankInfoController {

    @Autowired
    private IPlatformBankInfoService platformBankInfoService;


    /**
     * 银行账户管理页面
     */
    @RequestMapping("companyBank_list")
    public String CompanyBankList(Model model, @ModelAttribute("qo") QueryObject qo) {
        model.addAttribute("pageResult", platformBankInfoService.queryForPage(qo));
        return "platformbankinfo/list";
    }

    /**
     * 保存与修改银行账号信息
     */
    @RequestMapping("companyBank_update")
    @ResponseBody
    public Object companyBankSaveOrUpdate(PlatformBankInfo platformBankInfo){
        platformBankInfoService.saveOrUpdate(platformBankInfo);
        return JSONResultUtil.jsonResult();
    }
}


